<?php require_once('Connections/learnConn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_learnConn, $learnConn);
$query_ta = "SELECT * FROM tahun_ajaran ORDER BY tahun_ajaran DESC";
$ta = mysql_query($query_ta, $learnConn) or die(mysql_error());
$row_ta = mysql_fetch_assoc($ta);
$totalRows_ta = mysql_num_rows($ta);

mysql_select_db($database_learnConn, $learnConn);
$query_ta2 = "SELECT * FROM tahun_ajaran ORDER BY tahun_ajaran DESC";
$ta2 = mysql_query($query_ta2, $learnConn) or die(mysql_error());
$row_ta2 = mysql_fetch_assoc($ta2);
$totalRows_ta2 = mysql_num_rows($ta2);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nilai dan Jadwal Online</title>
<link href="style/style.css" type="text/css" rel="stylesheet" />

<link rel="stylesheet" type="text/css" href="style/pro_drop_1.css" />
<script src="style/stuHover.js" type="text/javascript"></script>

<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
//-->
</script>
<link href="style/pro_drop_1.css" type="text/css" rel="stylesheet"/>
<script src="style/stuHover.js" type="text/javascript"></script>
</head>

<body><center>

<table width="900" bgcolor="#FFFFFF">
	<?php
	include "topmenu.php";
	?>
    <tr>
    	<td id="menu">
        <br>
		<br>
		<img src="gambar/smp5.png" />
		<!--
        <ul>
        	<li><a href="index.php">Home</a></li>
            <li><a href="profil.php">Profil</a></li>
        	<li><a href="fasilitas.php">Fasilitas</a></li>
            <li><a href="kegiatan.php">Kegiatan</a></li>
        	<li><a href="pengumuman.php">Pengumuman</a></li>
            <li><a href="buku_tamu.php">Buku Tamu</a></li>
        	<li><a href="nilai_jadwal.php">Nilai & Jadwal</a></li>
            <li><a href="login.php">Login</a></li>
        </ul>
		-->
        </td>
    	<td id="konten">
        <form action="nilai_hasil.php" method="post" name="nilai" onsubmit="MM_validateForm('nis','','R');return document.MM_returnValue">
        	<table bgcolor="#fff">
  <tr>
    <td colspan="3"><strong>CEK NILAI</strong></td>
    </tr>
  <tr>
    <td>NIS</td>
    <td>:</td>
    <td><input name="nis" type="text" id="nis" value="" size="32" /></td>
  </tr>
  <tr>
    <td>Tahun Ajaran</td>
    <td>:</td>
    <td><select name="ta">
      <?php do { ?>
      <option value="<?php echo $row_ta['tahun_ajaran']; ?>"><?php echo $row_ta['tahun_ajaran']; ?></option>
      <?php } while ($row_ta = mysql_fetch_assoc($ta)); ?>
    </select></td>
  </tr>
  <tr>
    <td>Semester</td>
    <td>:</td>
    <td><select name="smt">
    	<option value="ganjil">Ganjil</option>
    	<option value="genap">Genap</option>
    </select></td>
  </tr>
  <tr>
    <td colspan="3" align="right"><input type="submit" value="Cek Nilai" /></td>
    </tr>
</table>

        </form><br />
<br />
      </td>
    </tr>
    <tr>
    	<td colspan="2" id="footer">Copyright 2012</td>
    </tr>
    
</table></center>
</body>
</html>
<?php
mysql_free_result($ta);

mysql_free_result($ta2);
?>
